package org.lennon.demo.ddd.ticket.builder;

import org.lennon.demo.ddd.ticket.aggregate.TicketRecord;
import org.lennon.demo.ddd.ticket.entity.UserTicketRecordEntity;

import java.sql.Timestamp;

public class TicketRecordBuilder {

    public static UserTicketRecordEntity fromTickerRecord(TicketRecord ticketRecord) {
        UserTicketRecordEntity userTicketRecordEntity = new UserTicketRecordEntity();
        userTicketRecordEntity.setUserId(ticketRecord.getUserId());
        userTicketRecordEntity.setAmount(ticketRecord.getAmount());
        userTicketRecordEntity.setExtId(ticketRecord.getExtId());
        userTicketRecordEntity.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        return userTicketRecordEntity;
    }
}
